package heven.holt.library.binding

import android.graphics.drawable.Drawable
import android.widget.ImageView
import androidx.databinding.BindingAdapter
import heven.holt.library.extensions.setAvatar
import heven.holt.library.extensions.setPic
import heven.holt.library.extensions.setPicCenterCrop
import heven.holt.library.extensions.setPicRadius

@BindingAdapter("android:avatar")
fun bindAvatar(imageView: ImageView, url: String?) {
    imageView.setAvatar(url)
}

@BindingAdapter("android:pic")
fun bindPic(imageView: ImageView, url: String?) {
    imageView.setPic(url)
}

@BindingAdapter("android:pic")
fun bindPic(imageView: ImageView, drawable: Drawable?) {
    imageView.setPic(drawable)
}


@BindingAdapter("android:pic_center_croup")
fun bindPicCen(imageView: ImageView, url: String?) {
    imageView.setPicCenterCrop(url)
}

@BindingAdapter("android:pic", "android:radius")
fun bindPicRadius(imageView: ImageView, url: String?, radius: Int) {
    imageView.setPicRadius(url, radius)
}